package br.ucb.mercadojogador.managedbeans;

import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import br.ucb.mercadojogador.HIB.MercadoLogHIB;
import br.ucb.mercadojogador.beans.MercadoLog;

@ManagedBean (name="mercadoLogManagedBean")
@SessionScoped
public class MercadoLogManagedBean {
	private MercadoLog mercadoLog;
	private ArrayList<MercadoLog> mercadoLogs;
	private MercadoLogHIB mercadoLogDao;
	
	public MercadoLogManagedBean() {
		setMercadoLog(new MercadoLog());
		setMercadoLogs(new ArrayList<MercadoLog>());
		setMercadoLogDao(new MercadoLogHIB());
	}

	public MercadoLog getMercadoLog() {
		return mercadoLog;
	}

	public void setMercadoLog(MercadoLog mercadoLog) {
		this.mercadoLog = mercadoLog;
	}

	public ArrayList<MercadoLog> getMercadoLogs() {
		return mercadoLogs;
	}

	public void setMercadoLogs(ArrayList<MercadoLog> mercadoLogs) {
		this.mercadoLogs = mercadoLogs;
	}
	
	public MercadoLogHIB getMercadoLogDao() {
		return mercadoLogDao;
	}

	public void setMercadoLogDao(MercadoLogHIB mercadoLogDao) {
		this.mercadoLogDao = mercadoLogDao;
	}
	
	public String listar(){
		setMercadoLogs(new ArrayList<MercadoLog>());
		mercadoLogs.addAll(mercadoLogDao.listar());
		return "/pres/mercadoLogView?faces-redirect=true";
	}
	
}
